import request from "@/api/request";

// 加入购物车
export function shoppingCart(data) {
  return request({
    headers: {
      "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    method: "POST",
    url: "api/a/order/",
    data,
  });
}

// 获取购物车数据
export function getshoppingcart() {
  return request({
    method: "GET",
    url: "api/a/order/purchase/",
  });
}

// 获取订单数据
export function getorder() {
  return request({
    method: "GET",
    url: "api/a/order/",
  });
}

// 删除订单数据
export function delorder(id) {
  return request({
    method: "DELETE",
    url: "api/a/order/" + id,
  });
}

// 结算物品
export function settlement(data) {
  return request({
    method: "POST",
    url: "api/a/order/purchase/",
    data
  });
}

// 管理员获取所有订单
export function getorders() {
  return request({
    method: "GET",
    url: "/api/a/admin/order/",
    
  });
}

// 退货申请
export function getreturn(id) {
  return request({
    method: "PUT",
    url: "/api/a/order/" + id + "/",
    
  });
}

// 管理员退货处理
export function postreturn(id,action) {
  return request({
    method: "POST",
    url: "/api/a/admin/order/" + id + "/action/" + action +"/",
  });
}
